﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace sy2_2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void label3_Click(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            double fahrenheit = Convert.ToDouble(textBox1.Text);
            // 华氏温度转摄氏温度公式：C = 5.0 / 9 * (F - 32)
            double celsius = 5.0 / 9 * (fahrenheit - 32);
            // 将摄氏温度显示在 textBox2 中
            textBox2.Text = celsius.ToString();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            double celsius = Convert.ToDouble(textBox2.Text);
            // 摄氏温度转华氏温度公式：F = 9.0 / 5 * C + 32
            double fahrenheit = 9.0 / 5 * celsius + 32;
            // 将华氏温度显示在 textBox1 中
            textBox1.Text = fahrenheit.ToString();
        }
    }
}
